import { defineStore } from "pinia";
type Team = 'team1' | 'team2';
type BanType = 'hunter' | 'survivor';
interface GameInfoPinia {
    session: string
    team1: {
        survivorGlobalBan: Set<string>,
        hunterGlobalBan: Set<string>
    },
    team2: {
        survivorGlobalBan: Set<string>,
        hunterGlobalBan: Set<string>
    }
}
interface GameState {
    gameInfo: GameInfoPinia;
}
export const useGameStore = defineStore('gameStore', {
    state: (): GameState => ({
        gameInfo: {
            session: 'bo1',
            team1: {
                survivorGlobalBan: new Set(),
                hunterGlobalBan: new Set()
            },
            team2: {
                survivorGlobalBan: new Set(),
                hunterGlobalBan: new Set(),
            }
        }
    }),
    actions: {
        setGlobalBan(key: Team, banType: BanType, data: string[]) {
            data.forEach(item => {
                this.gameInfo[key][`${banType}GlobalBan`].add(item);
            })
        },
        clearGlobalBp(){
            this.gameInfo.team1.survivorGlobalBan.clear();
            this.gameInfo.team1.hunterGlobalBan.clear();
            this.gameInfo.team2.survivorGlobalBan.clear();
            this.gameInfo.team2.hunterGlobalBan.clear();
        }
    }
})